﻿Public Class frmrinomina
    Dim file As String
    Dim percorso As String

    
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub

    Public Sub carica_dati(ByVal filename As String)
        file = My.Computer.FileSystem.GetName(filename)
        percorso = My.Computer.FileSystem.GetParentPath(filename)
    End Sub

    Private Sub frmrinomina_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        TextBox1.Text = file
        TextBox1.Enabled = False
        TextBox2.Text = file
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox2.Text <> file Then
            My.Computer.FileSystem.RenameFile(percorso & "\" & file, TextBox2.Text)
        Else
            Me.Close()
        End If
        Me.Close()
        FrmDisegniClienti.ListBox1.SelectedIndex = FrmDisegniClienti.ListBox1.SelectedIndex
    End Sub
End Class